import Vue from 'vue'
import App from './App.vue'

import router from './router'
import Router from 'vue-router'
import store from './store'

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

import TypeNav from '@/components/TypeNav'//三级联动全局组件
import Carousel from '@/components/Carousel'//轮播图全局组件
import Pagination from '@/components/Pagination'//分页组件
Vue.component(TypeNav.name, TypeNav)
Vue.component(Pagination.name, Pagination)
Vue.component(Carousel.name, Carousel)

import VueLazyload from 'vue-lazyload'//引入图片懒加载
Vue.use(VueLazyload,{
  loading:require('@/assets/1.png')
})

import './permission'
import '@/mock/mockServe'//mock数据
import 'swiper/css/swiper.min.css'
import "@/plugins/validate"//引入表单验证插件

import { post, get, From, postJson } from '@/api/request'
Vue.prototype.$post = post;
Vue.prototype.$get = get;
Vue.prototype.$From = From;
Vue.prototype.$postJson = postJson;

Vue.config.productionTip = false


//解决重复点击路由报错
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}


new Vue({
  render: h => h(App),
  beforeCreate() {
    Vue.prototype.$bus = this;//方便兄弟组件通信
  },
  router,
  store//这时组件实例身上多了个$store的属性
}).$mount('#app')
